Skip to content

fix(build): normalize Windows backslash paths for sourcemap resolution#714

Merged
BYK merged 4 commits intomainfrom
fix/windows-sourcemap-paths
Apr 10, 2026
Merged

fix(build): normalize Windows backslash paths for sourcemap resolution#714
BYK merged 4 commits intomainfrom
fix/windows-sourcemap-paths

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 10, 2026

Summary

  • Normalize Windows backslashes (\) to forward slashes (/) in the telemetry beforeSend hook so frame paths match uploaded sourcemap artifact URLs
  • Normalize the sourcemap sources array during debug ID injection so bundlers on Windows produce consistent paths

Fixes https://sentry.sentry.io/issues/7402821077/

Problem

On Windows, Bun compiled binaries resolve Error.stack frame paths with backslashes (e.g., dist-bin\bin.js). The ensureAbsolute() function in telemetry.ts prepended / but didn't convert backslashes, producing /dist-bin\bin.js. The Sentry symbolicator couldn't match this to the uploaded artifact at ~/dist-bin/bin.js, so sourcemaps were never applied — stack traces showed minified function names like ut with no source context.

Changes

  • src/lib/telemetry.ts: Add .replaceAll("\\", "/") in ensureAbsolute() before the relative-path check. Covers frame.filename, frame.abs_path, and debug_meta.images[].code_file.
  • src/lib/sourcemap/debug-id.ts: Normalize sources array to forward slashes after parsing the sourcemap JSON. Benefits both the CLI's own build and user-facing sentry sourcemap inject.
  • test/script/debug-id.test.ts: Two new test cases for backslash normalization in sources and forward-slash preservation.

On Windows, Bun resolves Error.stack frame paths with backslashes
(e.g., "dist-bin\bin.js"). The beforeSend hook prepended "/" but did
not convert backslashes to forward slashes, producing "/dist-bin\bin.js"
which never matched the uploaded artifact at "~/dist-bin/bin.js".

Also normalizes the sourcemap sources array in debug ID injection so
bundlers on Windows produce consistent forward-slash paths regardless
of build platform.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (build) Normalize Windows backslash paths for sourcemap resolution by BYK in #714

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-714/

Built to branch gh-pages at 2026-04-10 23:39 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@BYK BYK marked this pull request as ready for review April 10, 2026 23:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1575 uncovered lines.
❌ Project coverage is 95.36%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.37%    95.36%    -0.01%
==========================================
  Files          232       232         —
  Lines        33927     33928        +1
  Branches         0         0         —
==========================================
+ Hits         32354     32353        -1
- Misses        1573      1575        +2
- Partials         0         0         —

Generated by Codecov Action

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f872f9. Configure here.

…ger regeneration

generate-skill.ts reads the version from package.json and embeds it
in skill file frontmatter. Without package.json in the paths-filter,
version bump commits (which only touch package.json + plugin.json)
skip the check-generated job entirely, leaving skill files stale.
Source Map v3 spec allows null entries in the sources array. Without
a guard, replaceAll() on null throws TypeError. Added null check and
a test case for this edge case.
@BYK BYK merged commit cff56b6 into main Apr 10, 2026
26 checks passed
@BYK BYK deleted the fix/windows-sourcemap-paths branch April 10, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant